package com.zzy.mccjt.service.common.framework.error.impl;

import com.zzy.mccjt.service.common.framework.error.BaseError;

/**
 * description:定义公共的一些错误码
 *
 * @author zzy
 * @version 1.0
 * @date 2020/4/3
 */
public enum  CommonError implements BaseError {

    /***状态码*/
    CERTIFICATE_INVALID(-100, "应用程序证书失效，请联系管理员"),
    UNAUTHORIZED(-101,"身份认证未通过"),
    UNKNOWN_ERROR(99999, "未定义异常"),
    MISSING_PARAMETER(10000,"缺少参数"),
    PARAMETER_ERROR(10002,"非法参数"),
    DB_OPERATION_ERROR(10003,"数据库操作异常"),
    DB_CONNECTION_TIMEOUT(10004,"数据库连接超时"),
    DATE_FORMAT_ERROR(10005,"时间格式不正确"),
    PROPAGATION_ERROR(10006,"该异常会在服务间传播，不会封装成WebApiResponse"),
    INTERNAL_SERVER_ERROR(10007,"内部服务请求异常"),
    HTTP_REQUEST_ERROR(10008,"HTTP请求异常");
    private Integer code;
    private String message;

    CommonError(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public int getCode() {
        return this.code;
    }

    @Override
    public String getMessage() {
        return this.message;
    }

    @Override
    public String toString() {
        return toString(getCode(), getMessage());
    }
}

